package yunheadmin.login;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.MonthDisplayHelper;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;

public class RegisterActivity extends Activity {

	EditText et_uid, et_password;
	RadioButton rb_male, rb_female;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_register);

		Button button = (Button) findViewById(R.id.bt_register);
		button.setOnClickListener(buttonListener);
		
		Button gotologin = (Button) findViewById(R.id.bt_gotologin);
		gotologin.setOnClickListener(gotologinbuttonListener);
	
		
		
		et_uid = (EditText) findViewById(R.id.et_uid);
		et_password = (EditText) findViewById(R.id.et_password);
		rb_male = (RadioButton) findViewById(R.id.rb_male);
		rb_female = (RadioButton) findViewById(R.id.rb_female);
	}

	public void passDate() {
		Intent intent = new Intent(this, SuccessActivity.class);
		intent.putExtra("uid", et_uid.getText().toString().trim());
		intent.putExtra("password", et_password.getText().toString().trim());
		String sex="";
		if(rb_female.isChecked()){
		sex=rb_female.getText().toString().trim();
		}
		else sex=rb_male.getText().toString().trim();
		
		intent.putExtra("sex",sex);
		startActivity(intent);
	}

	private OnClickListener buttonListener = new OnClickListener() {
		public void onClick(View v) {
			Toast.makeText(v.getContext(), "You have clicked a button!",
					Toast.LENGTH_LONG).show();
			passDate();
		}
	};
	private OnClickListener gotologinbuttonListener = new OnClickListener() {
		public void onClick(View v) {
		
			pass();
		}
	};
	public void pass() {
		Intent intents = new Intent(this, LoginActivity.class);
		startActivity(intents);
	}


}
